﻿@{
    ViewBag.Title = "新增权限";
}
@model FMS.UI.Areas.Admin.ViewModel.Permission
@section headsecion{
<style type="text/css">
    .tbList tr {
        height: 34px;
    }
    #imgIco {
        width: 16px;
        height: 16px;
        margin-left: 10px;
        line-height: 16px;
        display: inline-block;
    }
    .tbList {
        border: 1px solid #ddd;
        height: 99.5%;
        border-collapse: collapse;
        margin: 0;
        padding: 0;
        width: 100%;
        border-top-width: 0;
        border-bottom-width: 0;
        border-left-width: 0;
        border-right-width: 0;
    }

        .tbList td, th {
            border: 1px solid #ddd;
            padding: 0 5px;           
        }

    #tdname {
        width: 120px;
    }

    body {
        margin: 0;
        align-self: center;
    }

    #tdname {
        text-align: center;
    }

    #form0 {
        margin: 0;
        padding: 0;
    }

</style>

    <script type="text/javascript">
        $(function () {
            //下拉框value发生改变时 自动生成 要添加权限序号 自动+1
            $("#perParent").change(loadOrderNumber);
            $("#perParent").change();
            $("#perIco").change(changeIcon);
            $("#perIco").change();
        })
        //自动生成序号 loadOrderNumber
        function loadOrderNumber()
        {
            var parentId = this.value;
            $.post("/admin/permission/loadordernumber", { pId:parentId}, function (data) {
                $("#perOrder").val(data);
            });
        }

        //把选中的图标样式 设置 给div
        function changeIcon()
        {
            document.getElementById("imgIco").className = this.value;
        }

        function begin() {      
        }

        function complete(xhrobj) {
            $.msgProcess(xhrobj.responseText, function () {
                $.globalHelper.closeCommonWindow();//消息显示完后关闭对话框
                $.globalHelper.reloadSeletecTabDataGrid();
            });
        }


    </script>
}
@using (Ajax.BeginForm(new AjaxOptions() { OnBegin = "begin", OnComplete = "complete" }))
{ 
<table class="tbList">
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perName)</td>
        <td>@Html.TextBoxFor(o=>o.perName) @Html.ValidationMessageFor(o => o.perName)</td>
      
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perParent)</td>
        <td  >@Html.DropDownListFor(o => o.perParent, ViewBag.parpers as IEnumerable<SelectListItem>)</td>
      
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perAreaName)</td>
        <td >@Html.TextBoxFor(o => o.perAreaName)@Html.ValidationMessageFor(o => o.perAreaName)</td>
       
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perControllerName)</td>
        <td>@Html.TextBoxFor(o => o.perControllerName)@Html.ValidationMessageFor(o => o.perControllerName)</td>
     
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perActionName)</td>
        <td>@Html.TextBoxFor(o => o.perActionName)</td>
    
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perOrder)</td>
        <td>@Html.TextBoxFor(o => o.perOrder)</td>
     
    </tr>
    <tr>
        <td id="tdname">@Html.DisplayNameFor(o => o.perRemark)</td>
        <td>@Html.TextBoxFor(o => o.perRemark) @Html.ValidationMessageFor(o => o.perRemark)</td>
    
    </tr>
    <tr>
        <td colspan="3" style="text-align:center;border:0 solid white;margin-bottom:0">
            @Html.CheckBoxFor(o => o.perIsLink)  @Html.DisplayNameFor(o => o.perIsLink)
            @Html.CheckBoxFor(o => o.perIsShow) @Html.DisplayNameFor(o => o.perIsShow)
            <input type="submit" value="确定新增" style="height: 27px; width: 76px; margin-top: 6px;cursor:pointer"  />
        </td>
    </tr>
</table>
}